<?php
namespace app\walletyhbbadmin\controller;
use Think\Db;
use think\Collection;
use Think\page;
use think\Session;
class Tupian extends AdminBase{
    //空操作
    public function _empty(){
        header("HTTP/1.0 404 Not Found");
        $this->display('Public:404');
    }

    public function index(){
        $gywmtp=DB::name('Config')->where('name','gywmtp')->value('value');
        $cpzxtp=DB::name('Config')->where('name','cpzxtp')->value('value');
        $nbyytp=DB::name('Config')->where('name','nbyytp')->value('value');
        $xwzxtp=DB::name('Config')->where('name','xwzxtp')->value('value');
        $zxnstp=DB::name('Config')->where('name','zxnstp')->value('value');
        $lxwmtp=DB::name('Config')->where('name','lxwmtp')->value('value');
        $this->assign('gywmtp',$gywmtp);
        $this->assign('cpzxtp',$cpzxtp);
        $this->assign('nbyytp',$nbyytp);
        $this->assign('xwzxtp',$xwzxtp);
        $this->assign('zxnstp',$zxnstp);
        $this->assign('lxwmtp',$lxwmtp);
        return $this->fetch();
    }

    public function shangchuan(){
        $file = request()->file('gywmtp');
        if(!empty($file)){
            $info = $file->move(ROOT_PATH . 'public' . DS . 'uploads' );
            $data['value'] = '/public/uploads/' . str_replace('\\', '/', $info->getsaveName());
            DB::name('Config')->where('name','gywmtp')->update($data);
        }

        $this->success('修改成功');
    }

    public function shangchuan1(){
        $file = request()->file('cpzxtp');
        if(!empty($file)){
            $info = $file->move(ROOT_PATH . 'public' . DS . 'uploads' );
            $data['value'] = '/public/uploads/' . str_replace('\\', '/', $info->getsaveName());
            DB::name('Config')->where('name','cpzxtp')->update($data);
        }

        $this->success('修改成功');
    }

    public function shangchuan2(){
        $file = request()->file('nbyytp');
        if(!empty($file)){
            $info = $file->move(ROOT_PATH . 'public' . DS . 'uploads' );
            $data['value'] = '/public/uploads/' . str_replace('\\', '/', $info->getsaveName());
            DB::name('Config')->where('name','nbyytp')->update($data);
        }

        $this->success('修改成功');
    }

    public function shangchuan3(){
        $file = request()->file('xwzxtp');
        if(!empty($file)){
            $info = $file->move(ROOT_PATH . 'public' . DS . 'uploads' );
            $data['value'] = '/public/uploads/' . str_replace('\\', '/', $info->getsaveName());
            DB::name('Config')->where('name','xwzxtp')->update($data);
        }

        $this->success('修改成功');
    }

    public function shangchuan4(){
        $file = request()->file('zxnstp');
        if(!empty($file)){
            $info = $file->move(ROOT_PATH . 'public' . DS . 'uploads' );
            $data['value'] = '/public/uploads/' . str_replace('\\', '/', $info->getsaveName());
            DB::name('Config')->where('name','zxnstp')->update($data);
        }

        $this->success('修改成功');
    }

    public function shangchuan5(){
        $file = request()->file('lxwmtp');
        if(!empty($file)){
            $info = $file->move(ROOT_PATH . 'public' . DS . 'uploads' );
            $data['value'] = '/public/uploads/' . str_replace('\\', '/', $info->getsaveName());
            DB::name('Config')->where('name','lxwmtp')->update($data);
        }

        $this->success('修改成功');
    }
}